from random import choices, randint, shuffle

T = 10
c = ['1', '2', '3', '*']
pos = [(str(i), str(j)) for i in range(1, 4) for j in range(1, 4)]
run = open('run.sh', 'w')
team = [
    """0 0 0 1 1 0
0 2 1 1 1 2
2 0 2 1 2 2""", """0 0 1 0 1 1
0 1 0 2 1 2
2 0 2 1 2 2"""
]

for f_id in range(1, 31):
    pf = f'data/{f_id:03d}'
    f = open(pf + '.in', 'w')

    print(T, file=f)

    for _ in range(T):
        for _ in range(3):
            print(''.join(choices(c, [1, 1, 1, randint(5, 32)], k=3)), file=f)
        print(team[randint(0, 1)], file=f)
    cmd = './sol <' + pf + '.in' + ' >' + pf + '.out'
    print(cmd, file=run)
